package com.employee.util;

public class JsonResult {
    private int code;
    private String message;
    private Object data;
    
    public JsonResult() {
    }
    
    public JsonResult(int code, String message) {
        this.code = code;
        this.message = message;
    }
    
    public JsonResult(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    
    public static JsonResult success() {
        return new JsonResult(200, "操作成功");
    }
    
    public static JsonResult success(Object data) {
        return new JsonResult(200, "操作成功", data);
    }
    
    public static JsonResult success(String message, Object data) {
        return new JsonResult(200, message, data);
    }
    
    public static JsonResult error(String message) {
        return new JsonResult(500, message);
    }
    
    public static JsonResult error(int code, String message) {
        return new JsonResult(code, message);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
